package com.yx.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
//@EnableWebMvc
//public class WebConfig extends WebMvcConfigurationSupport {
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
//        映射static路径的请求到static目录下
//        静态资源访问路径和存放路径配置
//        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        // swagger访问配置
//        registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/", "classpath:/META-INF/resources/webjars/");
        //通过image访问本地的图片
        registry.addResourceHandler("/image/**").addResourceLocations("file:D:/study/1design2022/code/3minutes/3minutes-server/src/main/resources/static/img/");

    }
}
